	package com.chenhj.test;

import java.util.List;

import org.apache.cxf.endpoint.Client;
import org.apache.cxf.frontend.ClientProxy;
import org.junit.Before;
import org.junit.Test;

import com.chenhj.interceptor.ValidateOutInterceptor;
import com.chenhj.sei.Loanlimits;
import com.chenhj.sei.Result;
import com.chenhj.sei.ResultLoanlimits;
import com.chenhj.sei.imp.HelloWorld;
import com.chenhj.sei.imp.HelloWorldWSService;

public class HelloWorldWS {
	private static HelloWorld hw;
	
	@Before
	public void before(){
		
		HelloWorldWSService hws = new HelloWorldWSService();
		hw = hws.getHelloWorldWSPort();
		Client clientProxy = ClientProxy.getClient(hw);//通过目标ws获取代理
		clientProxy.getOutInterceptors().add(new ValidateOutInterceptor("chenhj","123456"));
	}
	
	@Test
	public void test(){
		
		Result result = hw.getCount("wzsy_ysx_znx_jsyh_all");
		
		System.out.println(result.getCode());
		System.out.println(result.getMsg());
		System.out.println(result.getContent());
		
		ResultLoanlimits resultLoanlimits = hw.getLoanlimits(0, 50, 0, "wzsy_ysx_znx_jsyh_all");
		System.out.println(resultLoanlimits.getCode());
		System.out.println(resultLoanlimits.getMsg());
		List<Loanlimits> loanlimits = resultLoanlimits.getLoanlimits();
		for (Loanlimits loanlimits2 : loanlimits) {
			System.out.println(loanlimits2.getDjxh());
		}
	}
}
